package com.spic.business.bp.controller;

import com.spic.business.bp.domain.BpPositionData;
import com.spic.business.bp.service.BpService;
import com.spic.common.core.web.controller.BaseController;
import com.spic.common.core.web.domain.AjaxResult;
import com.spic.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 边坡测点位置信息Controller
 *
 * @author spic
 * @date 2022-06-08
 */
@RestController
@RequestMapping("/bp/config")
public class BpPositionDataController extends BaseController
{
    @Autowired
    private BpService bpService;

    /**
     * 查询边坡测点位置信息列表
     */
    @GetMapping("/list")
    public TableDataInfo list(BpPositionData bpPositionData)
    {
        startPage();
        List<BpPositionData> list = bpService.selectBpPositionDataList(bpPositionData);
        return getDataTable(list);
    }

    /**
     * 获取边坡测点位置信息详细信息
     */
    @GetMapping(value = "/{name}")
    public AjaxResult getInfo(@PathVariable("name") String name)
    {
        return AjaxResult.success(bpService.selectBpPositionDataByName(name));
    }


    /**
     * 修改边坡测点位置信息
     */
    @PutMapping
    public AjaxResult edit(@RequestBody BpPositionData bpPositionData)
    {
        return toAjax(bpService.updateBpPositionData(bpPositionData));
    }
}
